﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true"
    Inherits="Admin_ConstituentInformation" CodeBehind="ConstituentInformation.aspx.cs" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajt" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="Server">
    <link href="../Styles/jquery-ui.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-ui.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $("#tabs").tabs({ 
                show: function() { 
                    var sel = $('#tabs').tabs('option', 'selected'); 
                    $("#<%= hidLastTab.ClientID %>").val(sel); 
                }, 
                selected: <%= hidLastTab.Value %> 
            }); 
        });         
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphTitle" runat="server">
    <asp:Label ID="lblName" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphBody" runat="Server">
    <table width="100%">
        <tr>
            <td align="left" width="33%"><asp:HyperLink ID="hyperBack" runat="server" Text="<--- Back" CssClass="normalText" /></td>
            <td align="center"><asp:HyperLink ID="hyperCreateJob" runat="server" Text="Create job" CssClass="normalText" /></td>
            <td width="33%"></td>
        </tr>
    </table>    
    <br />
    <br />
    <asp:ScriptManager ID="scriptManager1" runat="server" />
    <div id="tabs">
        <ul>            
            <li><a href="#tabs-1">Addresses</a></li>
            <li><a href="#tabs-2">Phones</a></li>
            <li><a href="#tabs-3">Emails</a></li>
            <li><a href="#tabs-4">Contacts</a></li>
            <li><a href="#tabs-5">Notes</a></li>
        </ul>
        <div id="tabs-1">
            <asp:LinkButton ID="btnNewAddress" Text="Create an address" runat="server" OnClick="btnNewAddress_Click" />
            <br />
            <br />
            <asp:GridView ID="grvAddresses" runat="server" AutoGenerateColumns="false" EmptyDataText="No addresses on file."
                DataKeyNames="ID" OnRowEditing="grvAddresses_EditRecord" OnRowUpdating="grvAddresses_UpdateRecord"
                OnRowDataBound="grvAddresses_RowDataBound" OnRowCancelingEdit="grvAddresses_CancelRecord"
                OnRowDeleting="grvAddresses_DeleteRecord" AutoGenerateEditButton="True">
                <Columns>
                    <asp:TemplateField HeaderText="Address" ItemStyle-Width="200">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "ADDRESSBLOCK") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtAddressBlock" runat="server" TextMode="MultiLine" Text='<%#DataBinder.Eval(Container.DataItem, "ADDRESSBLOCK") %>' />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="City">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "CITY") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtCity" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CITY") %>'
                                Width="100px" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="State">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "State.Abbreviation") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblState" runat="server" Visible="false" Text='<%# Eval("State.Abbreviation") %>' />
                            <asp:DropDownList ID="ddlState" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Post code">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "POSTCODE")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtPostCode" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "POSTCODE") %>'
                                Width="65px" />
                            <asp:RegularExpressionValidator ID="revTxtZip" runat="server" ControlToValidate="txtPostCode"
                                ErrorMessage="Invalid zip code" ValidationExpression="^\d+$" ForeColor="Red"
                                Display="Dynamic" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Country">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "Country.Abbreviation")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblCountry" runat="server" Visible="false" Text='<%# Eval("Country.Abbreviation") %>' />
                            <asp:DropDownList ID="ddlCountry" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Type">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "AddressType.Description")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblAddressType" runat="server" Visible="false" Text='<%# Eval("AddressType.Description") %>' />
                            <asp:DropDownList ID="ddlAddressType" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Primary">
                        <ItemTemplate>
                            <asp:Image ID="imgIsPrimary" runat="server" ImageUrl="~/Images/check_20x15.png" Visible='<%#DataBinder.Eval(Container.DataItem, "IsPrimary") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="chkIsPrimary" runat="server" Checked='<%#DataBinder.Eval(Container.DataItem, "IsPrimary") %>' />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("ID") %>'
                                CommandName="Delete" Text="Delete" ForeColor="Black" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
        <div id="tabs-2">
            <asp:LinkButton ID="btnNewPhone" Text="Create a phone" runat="server" OnClick="btnNewPhone_Click" />
            <br />
            <br />
            <asp:GridView ID="grvPhones" runat="server" AutoGenerateColumns="false" EmptyDataText="No phone numbers on file."
                DataKeyNames="ID" OnRowEditing="grvPhones_EditRecord" OnRowUpdating="grvPhones_UpdateRecord"
                OnRowDataBound="grvPhones_RowDataBound" OnRowCancelingEdit="grvPhones_CancelRecord"
                OnRowDeleting="grvPhones_DeleteRecord" AutoGenerateEditButton="True">
                <Columns>
                    <asp:TemplateField HeaderText="Number">
                        <ItemTemplate>
                            <asp:Label ID="lblNumber" runat="server" Text='<%# Eval("FORMATTEDNUMBERWITHEXTENSION") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtNumber" runat="server" Text='<%# Eval("NUMBER") %>' />
                            ext.
                            <asp:TextBox ID="txtNumberExtension" runat="server" Text='<%# Eval("EXTENSION") %>' />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Type">
                        <ItemTemplate>
                            <asp:Label ID="lblPhoneType" runat="server" Text='<%# Eval("PhoneType.Description")%>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblPhoneType" runat="server" Text='<%# Eval("PhoneType.Description")%>'
                                Visible="false" />
                            <asp:DropDownList ID="ddlPhoneType" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Primary">
                        <ItemTemplate>
                            <asp:Image ID="imgIsPrimary" runat="server" ImageUrl="~/Images/check_20x15.png" Visible='<%#DataBinder.Eval(Container.DataItem, "IsPrimary") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="chkIsPrimary" runat="server" Checked='<%#DataBinder.Eval(Container.DataItem, "IsPrimary") %>' />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("ID") %>'
                                CommandName="Delete" Text="Delete" ForeColor="Black" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
        <div id="tabs-3">
            <asp:LinkButton ID="btnNewEmail" Text="Create an email" runat="server" OnClick="btnNewEmail_Click" />
            <br />
            <br />
            <asp:GridView ID="grvEmails" runat="server" AutoGenerateColumns="false" EmptyDataText="No emails on file."
                DataKeyNames="ID" OnRowEditing="grvEmails_EditRecord" OnRowUpdating="grvEmails_UpdateRecord"
                OnRowDataBound="grvEmails_RowDataBound" OnRowCancelingEdit="grvEmails_CancelRecord"
                OnRowDeleting="grvEmails_DeleteRecord" AutoGenerateEditButton="True">
                <Columns>
                    <asp:TemplateField HeaderText="Email address">
                        <ItemTemplate>
                            <%# DataBinder.Eval(Container.DataItem, "EMAILADDRESS") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtEmailAddress" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EMAILADDRESS") %>' />
                            <asp:RequiredFieldValidator ID="rfvTxtEmail" ControlToValidate="txtEmailAddress"
                                ErrorMessage="* required" ValidationGroup="UpdateEmail" runat="server" />
                            <asp:RegularExpressionValidator ID="revTxtEmailAddress" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                ControlToValidate="txtEmailAddress" ErrorMessage="Invalid email address" ForeColor="Red"
                                ValidationGroup="UpdateEmail" Display="Dynamic" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Type">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "EmailAddressType.Description")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblEmailAddressType" runat="server" Text='<%# Eval("EmailAddressType.Description")%>'
                                Visible="false" />
                            <asp:DropDownList ID="ddlEmailAddressType" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Primary">
                        <ItemTemplate>
                            <asp:Image ID="imgIsPrimary" runat="server" ImageUrl="~/Images/check_20x15.png" Visible='<%#DataBinder.Eval(Container.DataItem, "IsPrimary") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="chkIsPrimary" runat="server" Checked='<%#DataBinder.Eval(Container.DataItem, "IsPrimary") %>' />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("ID") %>'
                                CommandName="Delete" Text="Delete" ForeColor="Black" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
        <div id="tabs-4">
            <asp:LinkButton ID="btnNewRelationship" Text="Create a contact" runat="server" OnClick="btnNewRelationship_Click" />
            <br />
            <br />
            <asp:GridView ID="grvRelationships" runat="server" AutoGenerateColumns="false" EmptyDataText="No contacts on file.">
                <Columns>
                    <asp:TemplateField HeaderText="Primary">
                        <ItemTemplate>
                            <asp:Image ID="imgIsPrimary" runat="server" ImageUrl="~/Images/check_20x15.png" Visible='<%#DataBinder.Eval(Container.DataItem, "IsPrimary") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Who">
                        <ItemTemplate>
                            <asp:HyperLink ID="hyperLink" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CONSTITUENT.NAME") %>'
                                NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "CONSTITUENT.ID", "~/Admin/ConstituentInformation.aspx?id={0}") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Type">
                        <ItemTemplate>
                            <%# DataBinder.Eval(Container.DataItem, "TYPE.DESCRIPTION") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Number">
                        <ItemTemplate>
                            <%# DataBinder.Eval(Container.DataItem, "CONSTITUENT.PHONE.FORMATTEDNUMBERWITHEXTENSION") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
        <div id="tabs-5">
            <asp:LinkButton ID="btnNewNote" Text="Create a note" runat="server" OnClick="btnNewNote_Click" />
            <br />
            <br />
            <asp:GridView ID="grvNotes" runat="server" AutoGenerateColumns="false" EmptyDataText="No notes on file."
                DataKeyNames="ID" OnRowEditing="grvNotes_EditRecord" OnRowUpdating="grvNotes_UpdateRecord"
                OnRowDataBound="grvNotes_RowDataBound" OnRowCancelingEdit="grvNotes_CancelRecord"
                OnRowDeleting="grvNotes_DeleteRecord" AutoGenerateEditButton="True">
                <Columns>
                    <asp:BoundField DataField="ADDEDBY" HeaderText="Creator" />
                    <asp:TemplateField HeaderText="Note">
                        <ItemTemplate>
                            <%# DataBinder.Eval(Container.DataItem, "TEXT") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtNote" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "TEXT") %>'
                                TextMode="MultiLine" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("ID") %>'
                                CommandName="Delete" Text="Delete" ForeColor="Black" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
    </div>
    <%--start phone modal--%>
    <ajt:ModalPopupExtender ID="modalNewPhone" runat="server" CancelControlID="btnPhoneCancel"
        TargetControlID="btnNewPhone" PopupControlID="pnlNewPhone" PopupDragHandleControlID="PopupHeader"
        Drag="true" BehaviorID="ShowPhoneModal" BackgroundCssClass="modalBackground">
    </ajt:ModalPopupExtender>
    <asp:Panel ID="pnlNewPhone" runat="server">
        <div id="modalPhone">
            <div class="modal">
                <table width="300" border="0">
                    <tr>
                        <td align="center" colspan="2">
                            <p>
                                Create a phone</p>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblPhoneError" runat="server" CssClass="errorLabel" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Type:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlPhoneType" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Phone:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtPhone" runat="server" MaxLength="20" Columns="11" />
                            ext.
                            <asp:TextBox ID="txtExtension" runat="server" MaxLength="6" Columns="3" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Is primary:
                        </td>
                        <td align="left">
                            <asp:CheckBox ID="chkPhoneIsPrimary" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Button ID="btnPhoneCancel" runat="server" Text="Cancel" />
                        </td>
                        <td align="right">
                            <asp:Button ID="btnPhoneSubmit" runat="server" Text="Create" CausesValidation="false"
                                OnClick="btnPhoneSubmit_Click" OnClientClick="showPhoneModal();" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </asp:Panel>
    <%--end phone modal--%>
    <%--start email modal--%>
    <ajt:ModalPopupExtender ID="modalNewEmail" runat="server" CancelControlID="btnEmailCancel"
        TargetControlID="btnNewEmail" PopupControlID="pnlNewEmail" PopupDragHandleControlID="PopupHeader"
        Drag="true" BehaviorID="ShowEmailModal" BackgroundCssClass="modalBackground">
    </ajt:ModalPopupExtender>
    <asp:Panel ID="pnlNewEmail" runat="server">
        <div id="modalEmail">
            <div class="modal">
                <table width="300" border="0">
                    <tr>
                        <td align="center" colspan="2">
                            <p>
                                Create an email</p>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblEmailError" runat="server" CssClass="errorLabel" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Type:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlEmailType" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Email:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtEmail" runat="server" MaxLength="100" />
                            <asp:RequiredFieldValidator ID="rfvTxtEmail" ControlToValidate="txtEmail" ErrorMessage="* required"
                                ValidationGroup="CreateEmail" runat="server" />
                            <asp:RegularExpressionValidator ID="revTxtEmail" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                ControlToValidate="txtEmail" ErrorMessage="Invalid email address" ForeColor="Red"
                                ValidationGroup="CreateEmail" Display="Dynamic" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Is primary:
                        </td>
                        <td align="left">
                            <asp:CheckBox ID="chkEmailIsPrimary" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Button ID="btnEmailCancel" runat="server" Text="Cancel" />
                        </td>
                        <td align="right">
                            <asp:Button ID="btnEmailSubmit" runat="server" Text="Create" CausesValidation="false"
                                OnClick="btnEmailSubmit_Click" OnClientClick="showEmailModal();" ValidationGroup="CreateEmail" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </asp:Panel>
    <%--end email modal--%>
    <%--start address modal--%>
    <ajt:ModalPopupExtender ID="modalNewAddress" runat="server" CancelControlID="btnAddressCancel"
        TargetControlID="btnNewAddress" PopupControlID="pnlNewAddress" PopupDragHandleControlID="PopupHeader"
        Drag="true" BehaviorID="ShowAddressModal" BackgroundCssClass="modalBackground">
    </ajt:ModalPopupExtender>
    <asp:Panel ID="pnlNewAddress" runat="server">
        <div id="modalAddress">
            <div class="modal">
                <table width="300" border="0">
                    <tr>
                        <td align="center" colspan="2">
                            <p>
                                Create an address</p>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblAddressError" runat="server" CssClass="errorLabel" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Type:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlAddressType" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" align="left">
                            Address:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine" MaxLength="1000" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            City:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtCity" runat="server" MaxLength="50" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            State:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlState" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Zip code:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtZip" runat="server" MaxLength="12" Columns="8" />
                            <asp:RegularExpressionValidator ID="revTxtZip" runat="server" ControlToValidate="txtZip"
                                ErrorMessage="Invalid zip code" ValidationExpression="^\d+$" ForeColor="Red"
                                Display="Dynamic" ValidationGroup="CreateAddress" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Country:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlCountry" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Is primary:
                        </td>
                        <td align="left">
                            <asp:CheckBox ID="chkAddressIsPrimary" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Button ID="btnAddressCancel" runat="server" Text="Cancel" />
                        </td>
                        <td align="right">
                            <asp:Button ID="btnAddressSubmit" runat="server" Text="Create" CausesValidation="false"
                                OnClick="btnAddressSubmit_Click" OnClientClick="showAddressModal();" ValidationGroup="CreateAddress" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </asp:Panel>
    <%--end address modal--%>
    <%--start relationship modal--%>
    <ajt:ModalPopupExtender ID="modalNewRelationship" runat="server" CancelControlID="btnRelationshipCancel"
        TargetControlID="btnNewRelationship" PopupControlID="pnlNewRelationship" PopupDragHandleControlID="PopupHeader"
        Drag="true" BehaviorID="ShowRelationshipModal" BackgroundCssClass="modalBackground">
    </ajt:ModalPopupExtender>
    <asp:Panel ID="pnlNewRelationship" runat="server">
        <div id="modalRelationship">
            <div class="modal">
                <table width="300" border="0">
                    <tr>
                        <td align="center" colspan="2">
                            <p>
                                Create a relationship</p>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblRelationshipError" runat="server" CssClass="errorLabel" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Label ID="lblNameRelationship" runat="server" />
                            is the
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlRelationshipTypes" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left" colspan="2">
                            and
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:TextBox ID="txtAutoComplete" runat="server" />
                            is the
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlReciprocalRelationshipTypes" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="left">
                            <asp:CheckBox ID="chkRelationshipIsPrimary" runat="server" Text="Is Primary" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Button ID="btnRelationshipCancel" runat="server" Text="Cancel" />
                        </td>
                        <td align="right">
                            <asp:Button ID="btnRelationshipSubmit" runat="server" Text="Create" CausesValidation="false"
                                OnClick="btnRelationshipSubmit_Click" OnClientClick="showRelationshipModal();" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </asp:Panel>
    <%--end relationship modal--%>
    <%--start note modal--%>
    <ajt:ModalPopupExtender ID="modalNewNote" runat="server" CancelControlID="btnNoteCancel"
        TargetControlID="btnNewNote" PopupControlID="pnlNewNote" PopupDragHandleControlID="PopupHeader"
        Drag="true" BehaviorID="ShowNoteModal" BackgroundCssClass="modalBackground">
    </ajt:ModalPopupExtender>
    <asp:Panel ID="pnlNewNote" runat="server">
        <div id="modalNote">
            <div class="modal">
                <table width="300" border="0">
                    <tr>
                        <td align="center" colspan="2">
                            <p>
                                Create a note</p>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblNoteError" runat="server" CssClass="errorLabel" />
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">
                            <asp:TextBox ID="txtNewNote" runat="server" TextMode="MultiLine" MaxLength="4000"
                                Columns="40" Rows="10" />
                            <asp:RequiredFieldValidator ID="rfvTxtNewNote" runat="server" ErrorMessage="* required"
                                ControlToValidate="txtNewNote" ValidationGroup="CreateNote" ForeColor="Red" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Button ID="btnNoteCancel" runat="server" Text="Cancel" />
                        </td>
                        <td align="right">
                            <asp:Button ID="btnNoteSubmit" runat="server" Text="Create" CausesValidation="false"
                                OnClick="btnNoteSubmit_Click" OnClientClick="showNoteModal();" ValidationGroup="CreateNote" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </asp:Panel>
    <%--end note modal--%>
    <%--used to keep the user on the correct tab after a postback--%>
    <asp:HiddenField runat="server" ID="hidLastTab" Value="0" />
</asp:Content>
